package com.oto.web.model;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * @author xueqiang.mi
 * @since 2010-12-18
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "message")
public class Message {

	@XmlElement(name = "from")
	private XmlAccount fromUser;
	@XmlElement(name = "to")
	private List<XmlAccount> toUsers;
	@XmlElement(name = "pack")
	protected List<XmlPack> packs;

	public XmlAccount getFromUser() {
		return fromUser;
	}

	public List<XmlPack> getPacks() {
		if (packs == null) {
			packs = new ArrayList<XmlPack>();
		}
		return packs;
	}

	public List<XmlAccount> getToUsers() {
		if (toUsers == null) {
			toUsers = new ArrayList<XmlAccount>();
		}
		return toUsers;
	}

	public void setFromUser(XmlAccount fromUser) {
		this.fromUser = fromUser;
	}

	public void setPacks(List<XmlPack> packs) {
		this.packs = packs;
	}

	public void setToUsers(List<XmlAccount> toUsers) {
		this.toUsers = toUsers;
	}

	@Override
	public String toString() {
		return "Message [fromUser=" + fromUser + ", toUsers=" + toUsers + ", packs=" + packs + "]";
	}
}
